<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.js"></script>
    <script>
        window.onload = function(){
            $.ajax({
                url:"http://localhost:3000/mainContent/indexx",
                type:'get',
                dataType:'json',
                success:function(res){
                    var e =res.data
                    console.log(e)
                    console.log("开始执行")
                    var strHTML = ''
            for(var i=0;i<e.length;i++){
                strHTML += `<div class="read">
                    <h3 onclick="changeUrl(this)">${e[i].titile}</h3>
                    <div class="innerContent"> <div class="imagess"><img src="images/bigpic1.JPG" style="width: 200px; height: 80px;"></div>
                        <div class="innerHtml">${e[i].content}</div>
                    </div>
                    <div style="margin-top: 10px;">
                        <div class="add" style="width: 90px; height: 30px; line-height: 30px;"><div class="divs"></div>赞同${e[i].like}</div>
                        <div class="add" style="width: 40px; height: 30px; margin-left: 10px;"><div class="divss"></div></div></div>
                        <div style="float: left;">
                            <ul style="float:left;margin:0px;padding-left: 60px;">
                                <li class="inner" onclick=showAnswers(this)><img class="images" src="images/评论.png"><span class="ziti">${e[i].pTime}条评论</span></li>
                                <li class="inner"><img class="images" src="images/分享.png"><span class="ziti">分享</span></li>
                                <li class="inner"><img class="images" src="images/喜欢.png"><span class="ziti">喜欢</span></li>
                                <li class="inner"><img class="images" src="images/举报.png"><span class="ziti">举报</span></li>
                            </ul>
                        </div>
                    <p style="clear: both;"></p> 
                </div>
                <div class="answers">
            <div class="anserTitle">
                <span>319条评论</span>
            </div>
            <div id="answerUl">
                <ul>
                    <li>
                            <img src="images/01.jpg" alt="">
                            <span class="name">小仙女</span>
                            <span class="datas">8-21</span>
                            <p>的哈市俺啥都暗示按时打开后打开后打的好的啊哈打开的哈市俺啥都暗示按时打开后打开后打的好的啊哈打开的哈市俺啥都暗示按时打开后打开后打的好的啊哈打开的哈市俺啥都暗示按时打开后打开后打的好的啊哈打开的哈市俺啥都暗示按时打开后打开后打的好的啊哈打开</p>
                            
                    </li>
                </ul>
            </div>
        </div>` 
        }
        $('#total').html(strHTML)
        }
    })
}
    </script>
</head>
<body>
    <div id="total"></div>
</body>
</html>